package com.airlines.common;

import java.io.Serializable;

/**
 * 
 * @author xxxx
 * @date 2017年9月15日
 * @company xxxx Airlines
 * @description 1.为了统一格式 2.为了应用AOP 3.为了包装异常信息
 */
public class ResultBean<T> implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public static final int FAIL = 0;//失败

	public static final int SUCCESS = 1;//成功
	
	public static final int NOT_PERMISSION = 2;//没有权限
	
	private String msg = "";
	
	private  int code = SUCCESS;
	
	private T data;

	public ResultBean() {
		super();
	}
	
	public ResultBean(T data){
		super();
		this.data = data;
	}
	
	public ResultBean(Throwable e){
		super();
		this.msg = e.toString();
		this.code = FAIL;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public static int getSuccess() {
		return SUCCESS;
	}

	public static int getFail() {
		return FAIL;
	}

	public static int getNotPermission() {
		return NOT_PERMISSION;
	}
	

	
	
}
